home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Shutdown FX 1.3 Source / Shutdown FX ƒ / sfx wipes ƒ / Mr. Do outdone.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-14  |  3.7 KB  |  177 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Mr. Do outdone.c
  4.  
  5. Purpose:    This module handles clearing the screen in a funky
  6.             manner.  See the comments below for more details.
  7.             
  8.  
  9. Shutdown FX -=- graphic effects on shutdown
  10. Copyright (C) 1993 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define        BoxSize    2
  32. #define CorrectTime 3
  33.  
  34. void MrDoOutdone(GrafPtr thePtr, Pattern *thePattern, int width, int height);
  35.  
  36. /* 25 regions on screen, in a 5 x 5 grid.  Regions alternate as to whether they
  37.    scroll up or down. */
  38.    
  39. void MrDoOutdone(GrafPtr thePtr, Pattern *thePattern, int width, int height)
  40. {
  41.     int            x, y;
  42.     int            vgap,hgap;
  43.     Rect        theRect, dest;
  44.     Rect        scrollsource, scrolldest;
  45.     Rect        bounds[25];
  46.     
  47.     vgap=height/5;
  48.     hgap=width/5;
  49.     
  50.     for (x=0; x<25; x++)
  51.     {
  52.         switch (x)
  53.         {
  54.             case 0:
  55.             case 1:
  56.             case 2:
  57.             case 3:
  58.             case 4:
  59.                 bounds[x].top=0;
  60.                 break;
  61.             case 15:
  62.             case 16:
  63.             case 17:
  64.             case 18:
  65.             case 5:
  66.                 bounds[x].top=vgap;
  67.                 break;
  68.             case 14:
  69.             case 23:
  70.             case 24:
  71.             case 19:
  72.             case 6:
  73.                 bounds[x].top=vgap*2;
  74.                 break;
  75.             case 13:
  76.             case 22:
  77.             case 21:
  78.             case 20:
  79.             case 7:
  80.                 bounds[x].top=vgap*3;
  81.                 break;
  82.             case 12:
  83.             case 11:
  84.             case 10:
  85.             case 9:
  86.             case 8:
  87.                 bounds[x].top=vgap*4;
  88.                 break;
  89.         }
  90.         switch (x)
  91.         {
  92.             case 0:
  93.             case 15:
  94.             case 14:
  95.             case 13:
  96.             case 12:
  97.                 bounds[x].left=0;
  98.                 break;
  99.             case 1:
  100.             case 16:
  101.             case 23:
  102.             case 22:
  103.             case 11:
  104.                 bounds[x].left=hgap;
  105.                 break;
  106.             case 2:
  107.             case 17:
  108.             case 24:
  109.             case 21:
  110.             case 10:
  111.                 bounds[x].left=hgap*2;
  112.                 break;
  113.             case 3:
  114.             case 18:
  115.             case 19:
  116.             case 20:
  117.             case 9:
  118.                 bounds[x].left=hgap*3;
  119.                 break;
  120.             case 4:
  121.             case 5:
  122.             case 6:
  123.             case 7:
  124.             case 8:
  125.                 bounds[x].left=hgap*4;
  126.                 break;
  127.         }
  128.         bounds[x].left+=thePtr->portRect.left;
  129.         bounds[x].top+=thePtr->portRect.top;
  130.         bounds[x].bottom=bounds[x].top+vgap;
  131.         bounds[x].right=bounds[x].left+hgap;
  132.     }
  133.     
  134.     for (x=BoxSize; x<vgap; x+=BoxSize)
  135.     {        
  136.         StartTiming();
  137.         for (y=0; y<25; y++)
  138.         {
  139.             if (y%2)   /* these scroll up */
  140.             {
  141.                 scrollsource=bounds[y];
  142.                 scrollsource.top+=BoxSize;
  143.                 scrolldest=scrollsource;
  144.                 OffsetRect(&scrolldest,0,-BoxSize);
  145.                 
  146.                 dest=bounds[y];
  147.                 dest.top=dest.bottom-BoxSize;
  148.                 
  149.                 CopyBits(&(thePtr->portBits), &(thePtr->portBits),
  150.                         &scrollsource, &scrolldest, 0, 0L);
  151.                 FillRect(&dest, *thePattern);
  152.             }
  153.             else    /* these scroll down */
  154.             {
  155.                 scrollsource=bounds[y];
  156.                 scrollsource.bottom-=BoxSize;
  157.                 scrolldest = scrollsource;
  158.                 OffsetRect(&scrolldest, 0, BoxSize);
  159.                 
  160.                 dest=bounds[y];
  161.                 dest.bottom=dest.top+BoxSize;
  162.                 
  163.                 CopyBits(&(thePtr->portBits), &(thePtr->portBits),
  164.                         &scrollsource, &scrolldest, 0, 0L);
  165.                 FillRect(&dest, *thePattern);
  166.                 
  167.             }
  168.         }
  169.         TimeCorrection(CorrectTime);
  170.     }
  171.     
  172.     SetRect(&dest, thePtr->portRect.left,
  173.         thePtr->portRect.top, thePtr->portRect.right,
  174.         thePtr->portRect.bottom);
  175.     FillRect(&dest, *thePattern);
  176. }
  177.